package Thread;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86183
 * Date: 2023-01-09
 * Time: 23:14
 */
public class Thread10 {
    public static void main(String[] args) throws InterruptedException {
        Thread t = new Thread(() ->{
          while (!Thread.currentThread().isInterrupted()){
              System.out.println("Hello Thread");
              try {
                  Thread.sleep(1000);
              } catch (InterruptedException e) {
                  e.printStackTrace();
                  try {
                      Thread.sleep(3000);
                  } catch (InterruptedException ex) {
                      ex.printStackTrace();
                  }
                  break;
              }
          }
        });
        t.start();
        Thread.sleep(3000);
        t.interrupt();
    }
}
